package org.ymx.myArrayList;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {

        List<String> list=new ArrayList();
        MyArrayList<String> myArrayList = new MyArrayList();

        myArrayList.add("a");
        myArrayList.add("b");
        myArrayList.add("c");
        myArrayList.add("d");
        myArrayList.add("e");

        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");
        list.add("e");

        //System.out.println(myArrayList);
        for (String s : myArrayList) {
            System.out.print(s+"   ");
        }
        System.out.println();
        for (String s : list) {
            System.out.print(s+"   ");
        }

        System.out.println();
        System.out.println("---增加---");

        myArrayList.add(2,"f");
        list.add(2,"f");

        myArrayList.set(2,"h");

        for (String s : myArrayList) {
            System.out.print(s+"   ");
        }
        System.out.println();
        for (String s : list) {
            System.out.print(s+"   ");
        }
    }

}
